<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ page import="com.lmpop.trade.tb_returngoods.*" %>
<%@ page import="java.util.*" %>
<%@ page import="com.lmpop.trade.ti_user.*" %>
<% 
  	String s_detail_id = "";
  	if(request.getParameter("detail_id")!=null) s_detail_id = request.getParameter("detail_id");
	String s_user_id = "";
	Tb_returngoodsInfo tb_returngoodsInfo = new Tb_returngoodsInfo();
	Ti_userInfo userInfo = new Ti_userInfo();

	
  	Hashtable goodsmap = new Hashtable();

  	List goodslist = tb_returngoodsInfo.getListByPk(s_detail_id);

	String goods_name="",goods_id="",info_id="",reason="",state="",deal_reason="",order_no="",order_state="";
	if(goodslist!=null && goodslist.size()>0){
		goodsmap = (Hashtable)goodslist.get(0);
		if(goodsmap.get("info_id")!=null) info_id = goodsmap.get("info_id").toString();
		if(goodsmap.get("order_no")!=null) order_no = goodsmap.get("order_no").toString();
		if(goodsmap.get("goods_id")!=null) goods_id = goodsmap.get("goods_id").toString();
		if(goodsmap.get("reason")!=null) reason = goodsmap.get("reason").toString();
		if(goodsmap.get("user_id")!=null) s_user_id = goodsmap.get("user_id").toString();
		if(goodsmap.get("goods_name")!=null) goods_name = goodsmap.get("goods_name").toString();
		if(goodsmap.get("pub_state")!=null) state = goodsmap.get("pub_state").toString();
		if(goodsmap.get("deal_reason")!=null) deal_reason = goodsmap.get("deal_reason").toString();
		if(goodsmap.get("order_state")!=null) order_state = goodsmap.get("order_state").toString();
	}

	List userlist = userInfo.getUserNameByPK(s_user_id);
	String user_name = "";
	if(userlist!=null&&userlist.size()>0){
		Hashtable map = (Hashtable)userlist.get(0);
		if(map.get("user_name")!=null){
			user_name = map.get("user_name").toString();
		}
	}
	String session_user_id = "";	
	if( session.getAttribute("session_user_id") != null ){
		session_user_id = session.getAttribute("session_user_id").toString();
	}	
	
	String s_info_id = "";
	if(request.getParameter("info_id")!=null && !request.getParameter("info_id").equals("")){
		s_info_id = request.getParameter("info_id");
	}
	String s_order_no = "";
	if(request.getParameter("s_order_no")!=null && !request.getParameter("s_order_no").equals("")){
		s_order_no = request.getParameter("s_order_no");
	}
	String iStart = "0"; 
	if(request.getParameter("iStart")!=null) iStart = request.getParameter("iStart");
	 String para = "/program/admin/forReturn/index.jsp?info_id="+s_info_id+"&s_order_no="+s_order_no+"&iStart="+iStart;
%>
<html>
  <head>
    
    <title>处理退货申请</title>
	<link href="/program/admin/index/css/style.css" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="return.js"></script>
	<script type="text/javascript" src="/js/jquery.js"></script>
</head>

<body>

  
	
	<h1>处理退货申请</h1>
	

	<table width="100%" align="center" cellpadding="0" cellspacing="0" class="dl_so">
        <tr>
          <td width="9%" align="center"><img src="/program/admin/index/images/ban_01.gif" /></td>
          <td width="91%" align="left">
		  <h4>处理提示</h4>
		  <span>1:  受理退货过程中可先选择状态为正在处理中.</span><br/>
		  <span>2:  选择已处理状态不可再变更.</span>
		  </td>
        </tr>
      </table>
      <br/>

	
	
	<form action="/doTradeReg.do" method="post" name="addForm">
	<table width="100%" cellpadding="0" cellspacing="1" border="0" class="listtab">
		
		<tr>
			<td align="right" width="10%">
				退货单号:
			</td>
			<td><%=info_id%></td>
		</tr>

		<tr>
			<td align="right" width="10%">
				退货商品:
			</td>
			<td><%=goods_name %></td>
		</tr>

		<tr>
			<td align="right" width="10%">
				退货原因:
			</td>
			<td><%=reason %></td>
		</tr>
		
		<tr>
			<td align="right" width="10%">
				申请人:
			</td>
			<td><%=user_name %></td>
		</tr>
		<%
			if(!state.equals("")){
				if(state.equals("0") || state.equals("1") ){
		%>	
		<tr>
			<td align="right" width="10%">
				处理方式<font color="red">*</font>
			</td>
			<td>
				
					<input name="pub_state" value="1" type="radio" checked />处理中
					<input name="pub_state" value="2" type="radio" />已处理
				
			</td>
		</tr>
		<%
				}
			} 
		%>
		<tr>
			<td align="right" width="10%">
				处理原因<font color="red">*</font>
			</td>
			<td>
				<%
					if(state.equals("") || state.equals("0") || state.equals("1")){
				%>

				<textarea name="deal_reason" id="deal_reason"><%=deal_reason%></textarea>
				<script type="text/javascript" src="/program/plugins/ckeditor/ckeditor.js"></script>
				<script type="text/javascript">
					CKEDITOR.replace('deal_reason');
				</script>
				<%
					}
				%>

				<%
					if(state.equals("2") || state.equals("3")){
				%>

					<%=deal_reason%>
				<%
					}
				%>
			</td>
		</tr>

	</table>
	
	<table width="100%" cellpadding="0" cellspacing="0" border="0">
		<tr>
			<td align="center">

				<input type="hidden" name="user_id2" value="<%=session_user_id%>" />
				<input type="hidden" name="bpm_id" value="7828" />
				<input type="hidden" name="return_state" value="<%=order_state %>" />
				<input type="hidden" name="order_no" value="<%=order_no%>" />
				<input type="hidden" name="order_state" id="order_state" value="5" />
	  			<input type="hidden" name="return_id" value="<%=info_id %>" />
				<input type="hidden" name="detail_id" value="<%=s_detail_id %>" />
				<input type="hidden" name="jumpurl" value="<%=para%>" />
				<%
					if(state.equals("") || state.equals("0") || state.equals("1")){
				%>

				<input type="submit" class="buttoncss" name="tradeSub" value="提交" onclick="return submitValues()" />&nbsp;&nbsp;
				<%
					}
				%>
				<input type="button" class="buttoncss" name="tradeRut" value="返回" onclick="window.location.href='<%=para%>';"/>
			</td>
		</tr>
	</table>
	</form>
</body>

</html>
